home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / DESK / CORE / Desk / h_doc / Time < prev    next >
Text File  |  1996-05-21  |  4KB  |  115 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Desklib:Time.h
  12.     Author:  Copyright © 1992, 1993, 1994 Jason Williams, Jason Howat
  13.     Version: 1.02 (22 May 1994)
  14.     Purpose: time handling
  15. */
  16.  
  17.  
  18. #ifndef __Desk_Time_h
  19. #define __Desk_Time_h
  20.  
  21. #ifdef __cplusplus
  22.     extern "C" {
  23. #endif
  24.  
  25.  
  26. #ifndef __Desk_Core_h
  27.     #include "Desk.Core.h"
  28. #endif
  29.  
  30.  
  31. extern int Desk_Time_Monotonic(void);
  32.   /*
  33.    *  Veneer for the Desk_OS_ReadMonotonicTime SWI
  34.    *  Returns an integer representing the time since the computer was switched
  35.    *  on, in centiseconds.
  36.    *  Used with Desk_Wimp_PollIdle to poll every now and then, as in:
  37.    *    time = Desk_Time_Monotonic();
  38.    *    Desk_Wimp_PollIdle(mask, block, time + 100);  // Pollidle for 1 sec (100cs)
  39.    *
  40.    *  Can also be used to time things, i.e.
  41.    *    time = Desk_Time_Monotonic();
  42.    *    while (Desk_Time_Monotonic < time+100) |* wait *| ;    // Wait for 1 second
  43.    */
  44.  
  45.  
  46.  
  47. extern void    Desk_Time_ConvertDateAndTime(const char *fivebyteblock, char *buffer,
  48.                                          int bufflen, const char *format);
  49. /*
  50.  * Veneer for the Desk_OS_ConvertDateAndTime SWI.
  51.  * Uses the format string to convert the given time to text.
  52.  * Format codes:                             Field size:
  53.  *   CS      Centiseconds                        2
  54.  *   SE      Seconds                             2
  55.  *   MI      Minutes                             2
  56.  *   12      Hours (12hr format)                 2
  57.  *   24      Hours (24hr format)                 2
  58.  *   AM      'am' or 'pm'                        2
  59.  *   PM      ditto                               2
  60.  *   WE      Weekday                           varies
  61.  *   W3      Weekday (3 chars)                   3
  62.  *   WN      Weekday as number                   1
  63.  *   DY      Day of the month                    2
  64.  *   ST      'st', 'nd', 'rd' or 'th'            2
  65.  *   MO      Month name                        varies
  66.  *   M3      Month name (3 chars)                3
  67.  *   MN      Month as number                     2
  68.  *   CE      Century                             2
  69.  *   YR      Year within century                 2
  70.  *   WK      Week number (Mon-Sun)               2
  71.  *   DN      Day of year                         3
  72.  *   0       Insert an ASCII 0 byte              1
  73.  *   %       Insert a '%'                        1
  74.  
  75.  
  76.    *  Six time formats for ConvertDateAndTime are pre-defined for you:
  77.    *  
  78.    *  1. Desk_Time_CTIME is equal to ctime() found in ANSI C <time.h> without
  79.    *     the automatic \n inserted
  80.    *  
  81.    *  2. Desk_Time_STANDARD is the default setting found on most Arcs and not
  82.    *     the system variable <Sys$DateFormat>
  83.    *  
  84.    *  3. Desk_Time_FANCYDATE is Sunday, 16th of January, 1994.
  85.    *  
  86.    *  4. Desk_Time_SHORTTIME is 11:30pm
  87.    *  
  88.    *  5. Desk_Time_LONGTIME is 11:30:12pm
  89.    *  
  90.    *  6. Desk_Time_EUROTIME is 23:30:12
  91.    */
  92.    
  93. #define Desk_Time_CTIME     "%W3 %M3 %DY %z24:%MI:%SE %CE%YR"
  94. #define Desk_Time_STANDARD  "%24:%mi:%se %dy-%m3-%ce%yr"
  95. #define Desk_Time_FANCYDATE "%WE, %zDY%ST of %MO, %CE%YR"
  96. #define Desk_Time_SHORTTIME "%z12:%MI%pm"
  97. #define Desk_Time_LONGTIME  "%z12:%MI:%SE%pm"
  98. #define Desk_Time_EUROTIME  "%z24:%MI:%SE"
  99.  
  100.  
  101. extern void    Desk_Time_ConvertStandardDateAndTime(const char *fivebyteblock,
  102.                                                  char *buffer, int bufflen);
  103. /*
  104.  * Veneer for the Desk_OS_ConvertStandardDateAndTime SWI.
  105.  * Converts the given time into a string using the format string stored in
  106.  * Sys$DateFormat.
  107.  */
  108.  
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112.  
  113.  
  114. #endif
  115.